package txt;

import db.domain.User;
import org.junit.jupiter.api.Test;
import sf.database.meta.MetaHolder;
import sf.tools.reflect.Reflections;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class TT {
    public static void main(String[] args) throws URISyntaxException {
        String url = "https://www.cnblogs.com/SaraMoring/p/5708058.html";
        URI uri = new URI(url);
        System.out.println(uri.getScheme() + "://" + uri.getHost() + (uri.getPort() > 0 ? ":" + uri.getPort() : "") + uri.getPath() + "/");

        System.out.println((0 - 1) / 100 + 1);

        List<Integer> list = new ArrayList<>();
        list.add(1);
        list.add(7);
        list.add(9);
        list.add(3);
        list.add(5);
//        Collections.sort(list);
        System.out.println(list);
        System.out.println(list.stream().sorted().collect(Collectors.toList()));
        System.out.println(MetaHolder.getColumnMapping(User.class,User.Field.age));
        long l = System.currentTimeMillis();
        for (int i = 0; i < 5; i++) {
            System.out.println(MetaHolder.getColumnMapping(User.class,User.Field.age).getFieldName());
        }
        System.out.println(System.currentTimeMillis() - l);
        System.out.println(Reflections.fnToFieldName(User::isLock));
        l = System.currentTimeMillis();
        for (int i = 0; i < 5; i++) {
            System.out.println(Reflections.fnToFieldName(User::isLock));
        }
        System.out.println(System.currentTimeMillis() - l);
    }

    @Test
    public void test() {
        User u = new User();
        u.setNicename("12312");
        u.setAge(1);
        u.clearUpdate();
        u.fillNotNullValue();
        System.out.println(u);
    }
}
